package com.java46.gougoussowebs.util;


import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

/**
 * 邮件验证类
 *
 */
public class MyVerification extends Authenticator {
    String userName;
    String password;


    public MyVerification() {
        super();
    }
    //验证用户名以及密码
    @Override
    public PasswordAuthentication getPasswordAuthentication() {
        String username = this.userName;
        String password = this.password;
        if ((username != null) && (username.length() > 0) && (password != null) && (password.length() > 0)) {

            return new PasswordAuthentication(username, password);
        }
        return null;
    }

    public MyVerification(String userName, String password) {
        this.userName = userName;
        this.password = password;
    }
}
